﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Microsoft.Scripting.Ast;

namespace Scala.Compiler.Ast
{
    public class ConstantExpression:Expression
    {
        private readonly object _value;

        public ConstantExpression(object value)
        {
            _value = value;
        }

        public object Value
        {
            get
            {
                return _value;
            }
        }

        public override void Walk(ScalaWalker walker)
        {
            if (walker.Walk(this))
            {
            }
            walker.PostWalk(this);
        }

        public override Microsoft.Scripting.Ast.Expression Reduce()
        {
            return Expression.Constant(Value);
        }
    }
}
